package com.erebus.feignclient;

import com.taobao.base.model.TokenResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AuthServiceClientFallbackFactory implements FallbackFactory<AuthServiceClient> {



    @Override
    public AuthServiceClient create(Throwable cause) {

        return new AuthServiceClient() {
            @Override
            public TokenResponse checkToken(String token) {
                log.error("解析token发生熔断,索引信息:{},熔断异常:{}",token,cause.toString(),cause);
                //走降级了返回 false
                return new TokenResponse();
            }


        };
    }
}
